package com.Arsanesia.TempleRush.Views.Screens;

import com.Arsanesia.TempleRush.TempleRush;
import com.Arsanesia.TempleRush.Controllers.Listeners.BackFromAboutListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class AboutScreen extends AbstractScreen{
	private Image aboutImage;
	private Image backButton;
	private float BOTTOM_BACKBUTTON_MARGIN = 13.6f;
	private float LEFT_BACKBUTTON_MARGIN = 15.35f;
	public AboutScreen(TempleRush game){
		super(game);
	}
	
	@Override
	public void show(){
		super.show();
		//retrieve images texture atlas
		atlas = new TextureAtlas(Gdx.files.internal("Images/About/about.atlas"));
		//make "image" actors 
		aboutImage = new Image(atlas.createSprite("bg_about"));
		//save the actual size
		actualBgWidth = aboutImage.getWidth();
		actualBgHeight = aboutImage.getHeight();
		backButton = new Image(atlas.createSprite("back"));
		//listen to the click
		backButton.addListener(new BackFromAboutListener(game));
		//add the actors
		this.addActor(aboutImage);
		this.addActor(backButton);
	}
	
	@Override
	public void resize(int width, int height){
		super.resize(width, height);
		this.setViewport(actualBgWidth, actualBgHeight, false);
		//count the multiplier
//		float widthMultiplier = width/actualBgWidth;
//		float heightMultiplier = height/actualBgHeight;
		//recount the margins
//		LEFT_BACKBUTTON_MARGIN = widthMultiplier*LEFT_BACKBUTTON_MARGIN;
//		BOTTOM_BACKBUTTON_MARGIN = heightMultiplier*BOTTOM_BACKBUTTON_MARGIN;
		//set position
		backButton.setPosition(LEFT_BACKBUTTON_MARGIN, BOTTOM_BACKBUTTON_MARGIN);
		//resize button and background
//		backButton.setSize(widthMultiplier*backButton.getWidth(), heightMultiplier*backButton.getHeight());
//		aboutImage.setSize(width, height);
		
	}

	
	
	
}
